<layout name="page" />
<block name="content">
	<style>
		.progress {
			position: relative;
			background-color: #e2e2e2;
			border-radius: 2px;
			box-sizing: border-box;
			display: block;
			height: 20px;
			line-height: 18.5714px;
			margin-bottom: 0px;
			margin-top: 0px;
			overflow-x: hidden;
			overflow-y: hidden;
			text-align: center;
			border: 0px solid #ccc;
		}
		.progress .label {
			position: absolute;
			width: 100%;
			line-height: 20px;
			background-color: transparent;
		}
		.progress-bar {
			position: absolute;
			background-color: #2794EB;
			box-shadow: none;
			box-sizing: border-box;
			color: rgb(255, 255, 255);
			display: block;
			font-size: 12px;
			height: 20px;
			line-height: 20px;
			list-style-image: none;
			list-style-position: outside;
			list-style-type: none;
			margin-bottom: 0px;
			text-align: center;
			transition-delay: 0s;
			transition-duration: 0.6s;
			transition-property: width;
			transition-timing-function: ease;
		}
	</style>
	{:widget('page_header/adv_search',array('name'=>'项目管理'))}
	<div id="adv_search" class="hidden">
		<form method="post" name="form_adv_search" id="form_adv_search">
			<div id="adv_search_header" class="row" style="">
				<h1 style="">高级搜索</h1>
				<i class="x1" class=""></i>
				<a class="btn btn-normal" id="submit_adv_search">搜索</a>
				<a class="btn btn-return" id="close_adv_search">关闭</a>
			</div>
			<div class="row" id="adv_search_body" >
				<div class="box col-6">
					<label class=" input-label" for="li_name">项目名称：</label>
					<input  class="input" type="text" id="li_name" name="li_name" >
				</div>
				<div class="box col-6">
					<label class="input-label" for="li_content">项目描述：</label>
					<input class="input" type="text" id="li_content" name="li_content">
				</div>
				<div class="box col-6">
					<label class="input-label" for="eq_user_name">发起人：</label>
					<input  class="input" type="text" id="eq_user_name" name="eq_user_name" >
				</div>
				<div class="box col-6">
					<label class="input-label">登录时间：</label>
					<input type="text" class="input-date" name="be_create_time" readonly="readonly"/>
					<i class="date-mid">-</i>
					<input type="text" class="input-date" name="en_create_time" readonly="readonly"/>
				</div>
			</div>
		</form>
	</div>
	<div class="operate-panel">
		<if condition="$auth->admin">
			<a class="btn btn-del" onclick="del()">删除</a>
		</if>
		<div class="mid"></div>
		<a class="btn btn-normal" onclick="add()">新建项目</a>
	</div>
	<form id="form_data" name="form_data" method='post' class="sub">
		<div class="table">
			<ul>
				<li class="thead">
					<if condition="$auth->admin">
						<span class="w3"><label class="checkbox">
								<input type="checkbox" class="toggle-select-all" data="id[]">
								<i class="icon"></i></label></span>
					</if>
					<span class="w15 x2">项目名称</span>
					<span class="w10 x1">项目进度</span>
					<span class="w10">开始日期</span>
					<span class="w10 ">结束日期</span>
					<span class="w8">发起人</span>
					<span class="w8 x1">项目成员</span>
					<span class="w6">附件</span>
					<span class="w6">操作</span>
				</li>
				<if condition="empty($list)">
					<li class="no-data">
						没找到数据
					</li>
				</if>
				<foreach name="list" val="vo">
					<li class="tbody">
						<if condition="$auth->admin">
							<php>
								if($vo['user_id']==get_user_id()){
							</php>
							<span class="w3"> <label class="checkbox">
									<input type="checkbox" name="id[]" value="{$vo.id}" />
									<i class="icon"></i></label></span>
							<php>
								}else{
							</php>
							<span class="w3"></span>
							<php>
								}
							</php>
						</if>
						<span class="w15 x2"><a href="{:url('read')}&id={$vo.id}">{$vo.name}</a>&nbsp;&nbsp;</span>
						<span class="w10 x1" >
							<div class="progress text-center" style="margin-top:9px;">
								<div class="progress-bar" style="width:{$vo['finish_rate']}%;"></div>
								<div class="label text-center">
									{$vo.finish_rate}%
								</div>
							</div></span>
						<span class="w10">{$vo.start_date}</span>
						<span class="w10">{$vo.end_date}</span>
						<span class="w8 ">{$vo.user_name}</span>
						<span class="w8 x1">{:show_contact($vo['member'])}&nbsp;</span>

						<if condition="empty($vo['add_file'])">
							<span class="w6"></span>
							<else/>
							<span class="w6"><a class="btn-down" onclick="download('{$vo['add_file']}')">下载</a></span>
						</if>
						<span class="w6">
							<if condition="$vo['user_id']==get_user_id()">
								<a href="{:url('edit')}&id={$vo.id}">修改</a>
							</if></span>
					</li>
				</foreach>
			</ul>
		</div>
	</form>
	<if condition="!empty($list)">
		{$page}
	</if>
</block>
<block name="js">
	<script type="text/javascript">
		layui.use(['global'], function() {
			var $ = layui.jquery;
			var fn = {
				add : function() {
					window.open("{:url('add')}", "_self");
				},
				download : function(file) {
					winopen("{:url('download')}?file=" + file, 560, 470);
				},
				del : function() {
					if ($("input[name='id[]']:checked").length == 0) {
						layer.msg('请选择要删除的项目');
						return false;
					}
					layer.msg('确定要删除吗?', {
						time : 0,
						btn : ['确定', '取消'],
						yes : function(index) {
							var vars = $("#form_data").serialize();
							send_ajax("{:url('del')}", vars, function(ret) {
								if (ret.status) {
									layer.msg(ret.info, {
										time : 1200
									}, function() {
										location.reload(true);
									});
								}
							});
						},
						no : function(index) {
							layer.close(index);
						}
					});
				}
			};
			win_exp(fn);
			set_return_url(null);
		});
	</script>
</block>
